package com.zcg.blogger.controller;

import static org.junit.Assert.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.validation.BindingResult;

import com.zcg.blogger.model.User;


@RunWith(SpringJUnit4ClassRunner.class)		//表示继承了SpringJUnit4ClassRunner类
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
public class UserController{
	
	private static Logger logger = Logger.getLogger(UserController.class);
//	private ApplicationContext ac = null;
	@Resource
	private com.zcg.blogger.web.controller.UserController userController = null;
	
	@Test
	public void check() throws Exception{
		HttpSession session = new MockHttpSession();
		User user = new User();
		user.setEmail("s");
		user.setUsername("张晨刚");
		user.setPassword("a4069825");
		
		String i = userController.login(user,new BingingResultTest(),session,null);
		System.out.println(i);
	}
}
